#include "qdevicedialog.h"

#include "../libs/core/qdeviceview.h"

#include <QVBoxLayout>
QDeviceDialog::QDeviceDialog(const QMap<int, QString> &enabled, QWidget *parent) :
    QBaseDialog(parent),
    m_device_view(new QDeviceView)
{
    QVBoxLayout *v=new QVBoxLayout;
    v->setMargin(0);
    v->setSpacing(0);
    v->addWidget(m_device_view);
    this->setLayout(v);

    this->resize(800,400);

    m_device_view->set_enabled(enabled);
    connect(m_device_view,SIGNAL(select(tagDeviceInfo*)),this,SLOT(device_select(tagDeviceInfo*)));

    setProperty("panelwidget",true);

    setWindowTitle(tr("Device List"));
}

tagDeviceInfo QDeviceDialog::get_device()
{
    return m_device_info;
}

void QDeviceDialog::device_select(tagDeviceInfo *info)
{
    m_device_info=*info;
    close();
}
